package demo10;

public class test1 {
    public static void main(String[] args) {
    //利用构造方法获取Interger对象
        Integer i1 = new Integer(1);
        Integer i2 = new Integer("1");
        System.out.println(i1);
        System.out.println(i2);

    //利用静态方法获取Interger的对象
        System.out.println("===================");
        Integer i3 = Integer.valueOf(123);
        Integer i4 = Integer.valueOf("123");
        Integer i5 = Integer.valueOf("123",8);
        System.out.println(i3);
        System.out.println(i4);
        System.out.println(i5);

    //这两种方式获取对象的区别
        Integer i6 = Integer.valueOf(127);
        Integer i7 = Integer.valueOf(127);
        System.out.println(i7 == i6);
        Integer i8 = Integer.valueOf(128);
        Integer i9 = Integer.valueOf(128);
        System.out.println( i8 == i9);

        Integer i10 = new Integer(127);
        Integer i11 = new Integer(127);
        System.out.println(i10 == i11);

        Integer i12 = new Integer(128);
        Integer i13 = new Integer(128);
        System.out.println(i12 == i13);



    }
}
